package controller_struct

import "fmt"

func switchExpr() error {

	// 无fallthrough
	age := 1
	switch age {
	case 1:
		fmt.Printf("年龄为%d\n", age)
	case 3:
		fmt.Printf("年龄为%d\n", age)
	case 5:
		fmt.Printf("年龄为%d\n", age)
	default:
		fmt.Printf("年龄为%d\n", age)
	}

	// 有fallthrough
	switch age {
	case 1:
		fmt.Printf("fallthrough 年龄为%d\n", age)
		fallthrough
	case 3:
		fmt.Printf("fallthrough 年龄为%d\n", 3)
	case 5:
		fmt.Printf("fallthrough 年龄为%d\n", age)
	default:
		fmt.Printf("fallthrough 年龄为%d\n", age)
	}
	return nil
}

func switchExprPerformance(age int) {
	switch age {
	case 1:
		//fmt.Printf("年龄为%d\n", age)
	case 2:
		//fmt.Printf("年龄为%d\n", age)
	case 3:
		//fmt.Printf("年龄为%d\n", age)
	case 4:
		//fmt.Printf("年龄为%d\n", age)
	case 5:
		//fmt.Printf("年龄为%d\n", age)
	case 6:
		//fmt.Printf("年龄为%d\n", age)
	case 7:
		//fmt.Printf("年龄为%d\n", age)
	default:
		//fmt.Printf("年龄为%d\n", age)
	}
}

func ifExprPerformance(age int) {
	if age == 1 {
		//fmt.Printf("年龄为%d\n", age)
	} else if age == 2 {
		//fmt.Printf("年龄为%d\n", age)
	} else if age == 3 {
		//fmt.Printf("年龄为%d\n", age)
	} else if age == 4 {
		//fmt.Printf("年龄为%d\n", age)
	} else if age == 5 {
		//fmt.Printf("年龄为%d\n", age)
	} else if age == 6 {
		//fmt.Printf("年龄为%d\n", age)
	} else if age == 7 {
		//fmt.Printf("年龄为%d\n", age)
	} else {
		//fmt.Printf("年龄为%d\n", age)
	}
}

func forPerformance(orderNumbers []string) {
	for i := 0; i < len(orderNumbers); i++ {

	}
}

func forRangePerformance(orderNumbers []string) {
	for _ = range orderNumbers {

	}
}

func calculate(a, b int) int {
	return a + b
}
